package cn.edu.wynu.api.regular;

public class PhoneNumberJudge {

    /**
     * 手机号码的格式为：
     * 1. 以1开头
     * 2. 长度为11
     * @param phoneNumber 号码字符串
     * @return 判断结果
     */
    Boolean judgePhone(String phoneNumber) {
        if (!phoneNumber.startsWith("1")) return false;
        if (phoneNumber.length() != 11) return false;
        return true;
    }
    public static void main(String[] args) {
        String phoneNumber = "12345678901";

        PhoneNumberJudge judge = new PhoneNumberJudge();
        if (judge.judgePhone(phoneNumber)) {
            System.out.println("手机号码正确");
        } else {
            System.out.println("手机号码错误");
        }
    }
}
